﻿<?php
header("Content-type: text/html; charset=utf-8");
/*
	$pref = "";
	$gender = "";
	$min_age = "";
	$max_age = "";
	$condition = "";
	$checkNUMBER = 0;

	error_reporting(E_ALL & ~E_DEPRECATED);		//不要なエラー文を吐かないようにする
	require_once("db_connect.php");

	$enc = mb_detect_encoding($_POST["pref"],'ASCII,JIS,UTF-8,EUC-JP,SJIS');
	if(array_key_exists("pref",$_POST))$pref = htmlspecialchars(mb_convert_encoding($_POST["pref"],"UTF-8",$enc),ENT_QUOTES,"UTF-8");
	if(array_key_exists("gender",$_POST))$gender = htmlspecialchars(mb_convert_encoding($_POST["gender"],"UTF-8",$enc),ENT_QUOTES,"UTF-8");
	if(array_key_exists("min_age",$_POST))$min_age = htmlspecialchars(mb_convert_encoding($_POST["min_age"],"UTF-8",$enc),ENT_QUOTES,"UTF-8");
	if(array_key_exists("max_age",$_POST))$max_age = htmlspecialchars(mb_convert_encoding($_POST["max_age"],"UTF-8",$enc),ENT_QUOTES,"UTF-8");
	if(array_key_exists("condition",$_POST))$condition = htmlspecialchars(mb_convert_encoding($_POST["condition"],"UTF-8",$enc),ENT_QUOTES,"UTF-8");
	$statisticSQL = "SELECT ".(($condition=="statistics_post")?"statistics_post as 条件":"sub_category.sub_category_name as 条件").",count(*) as 人数 FROM application,volunteer_information,sub_category WHERE application.volunteer_information_id = volunteer_information.volunteer_information_id AND volunteer_information.sub_category_id = sub_category.sub_category_ID AND ";

	if(array_key_exists("pref",$_POST)){
		$statisticSQL = $statisticSQL." statistics_pref = '".$pref."'";
		$checkNUMBER++;
	}
	if(array_key_exists("gender",$_POST)){
		if($checkNUMBER!=0) $statisticSQL= $statisticSQL." AND";
		$statisticSQL= $statisticSQL." statistics_gender = '".$gender."'";
		$checkNUMBER++;
	}
	if(($max_age!="")||($min_age!="")){
		if(($min_age!="")&&($max_age!="")){
			if($checkNUMBER!=0) $statisticSQL= $statisticSQL." AND";
			$statisticSQL = $statisticSQL." statistics_age BETWEEN ".$min_age." AND ".$max_age;
			$checkNUMBER++;
		}
		if(($min_age!="")&&($max_age=="")){
			if($checkNUMBER!=0) $statisticSQL= $statisticSQL." AND";
			$statisticSQL = $statisticSQL." statistics_age > ".$min_age;
			$checkNUMBER++;
		}
		if(($min_age=="")&&($max_age!="")){
			if($checkNUMBER!=0) $statisticSQL= $statisticSQL." AND";
			$statisticSQL = $statisticSQL." statistics_age  < ".$max_age;
			$checkNUMBER++;
		}
	}
	if(array_key_exists("condition",$_POST)){
		$statisticSQL= $statisticSQL." GROUP BY ".(($condition=="volunteer_information_id")?"volunteer_information.":"").$condition;
	}
*/
$values = array("menma" => 1);

$json = json_encode($values);
echo $json;
/*
	$res =& $db->query($statisticSQL);

	if (PEAR::isError($res)) {
	    die($res->getMessage());
	}

	$values = array();
	$count = 0;
	while ($row =& $res->fetchRow(DB_FETCHMODE_ASSOC)) {
		$enc = mb_detect_encoding($row['条件'],'ASCII,JIS,UTF-8,EUC-JP,SJIS');
		array_push($values,mb_convert_encoding($row['条件'],"UTF-8",$enc),mb_convert_encoding($row['人数'],"UTF-8",$enc));
	}

	$json = json_encode($values);
<<<<<<< .mine
	echo $json;
	*/
?>=======
	echo $json;>>>>>>> .r259
